﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>员工管理</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
   <link href="../css/Jqbox.css" rel="stylesheet" type="text/css" /> 
    <script src="../js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../js/ligerui.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dialog.js" type="text/javascript"></script>
    <script src="../Js/conmon.js" type="text/javascript"></script>
    <script type="text/javascript">
        var $grid;
        var maiheight = 300;
        var maiWidth = 500;
        var $selectRow = null;
        var vUrl = null;
        var treepanel = null;
        var height = 0;
     

        $(function () {
          

            $("#layout1").ligerLayout({ leftWidth: 190});
            height = $(".l-layout-center").height();
            
            //显示gride
            $grid = $("#maingrid").ligerGrid({
                columns: [
               { display: '序号', align: 'left', width: 40, type: 'int', isSort: false,
                   render: function (item, i) {
                       i = i + 1;
                       return i;
                   }
               },
                { display: '姓名', name: 'M_NAME', align: 'left', width: 80 },
                { display: '工号', name: 'M_CODE', width: 100 },
                { display: '性别', name: 'M_SEX', width: 40,
                    render: function (item) {
                        if (item.M_SEX == 0) return "女";
                        else return "男";
                    }
                },
                { display: '电话', name: 'M_PHONE', width: 90 },
                { display: '区域', name: 'A_NAME', width: 100 },
                { display: '职务', name: 'R_NAME', width: 120 },
                { display: '部门', name: 'M_DEPAT', width: 130 },

                { display: '注册时间', name: 'M_DATE', type: 'date', dateFormat: "yyyy-MM-dd", width: 80 },
                 { display: '状态', name: 'M_STATUS', isSort: false, width: 60,
                     render: function (item) {
                         if (item.M_STATUS == -1) return "待审核";
                         else if (item.M_STATUS == 0) return "正常";
                         else if (item.M_STATUS == 1) return "停用";

                     }
                 },
                  { display: '操作', name: 'M_ID', isSort: false, width: 60,
                      render: function (item) {
                          return "<a   onclick='RuserPwd(" + item.M_ID + ",&quot;" + item.M_NAME + "&quot;)' href='javascript:' >重设密码</a>";
                      }
                  }


                ],
                parms: [{ name: 'userName', value: $("#txtUserName").val() }, { name: 'aid', value: '0' }, { name: 'rid', value: '0' }, { name: 'fileName', value: 'UserTable'}],
                dataAction: 'server', pageSize: 20,
                url: '../WebServer/MainAdmin.ashx?Action=AreaRolUserList',
                sortName: 'M_NAME',
                width: "100%", height: "100%",
                onDblClickRow: function (data, rowindex, rowobj) {
                    $selectRow = data;
                    ShowDialog("admin/UpdateUser.htm", "编辑", 600, 400);
                },
                onLoaded: function (gg) {
                    gg.gridloading.hide();
                    vUrl = "../WebServer/DownloadExcel.ashx?Action=UesrList&" + gg.data.Url;
                    ExdcleGo.href = urr;

                }

            });
      
           loadTree();

        });

        function loadTree() {
            $("#Orgtree").ligerTree({
                checkbox: false,
                slide: false,
                nodeWidth: 100,
                url: "../WebServer/ModelManage.ashx?Action=AreRoleTree&rnd=" + Math.random(),
                onSelect: function (node) {
                    //$("#Aid").val(node.areid);
                   // $("#Rid").val(node.value);
                    $("#Aid").val(node.data.areid);
                    $("#Rid").val(node.data.value);
                    $("#txtUserName").val("");
                    loadGrid();
                }
            });
           
            $("#treePanel").height(height-24);
        }
        function Search() {
            loadGrid();
        }
        function Excel() {
            //页面导出
            window.open(vUrl, "_blank"); 

        }
        function loadGrid() {


          
            if (!$grid) return;
            $("tbody > tr", $grid.gridbody).each(function () {
                $(this).remove();
            });
            $grid.setOptions({ parms: [{ name: 'userName', value: $("#txtUserName").val() }, { name: 'aid', value: $("#Aid").val() }, { name: 'rid', value: $("#Rid").val() }, { name: 'fileName', value: 'UserTable'}], newPage: 1, Rows: [], Total: 0 });   //设置数据参数
         
            $grid.loadData(true); //加载数据

        }
        var $UpdateItem = new Object();

        function RuserPwd(id, name) {
            $UpdateItem.id = id;
            $UpdateItem.name = name;
            ShowDialog("admin/UpdatePwd.htm", "修改密码", 270, 210);
        }
        
    </script>
   <style type="text/css"> 
 
            body{ padding:5px; margin:0; padding-bottom:15px;}
            #layout1{  width:100%;margin:0; padding:0;  }  
            .l-page-top{ height:80px; background:#f8f8f8; margin-bottom:3px;}
            h4{ margin:20px;}
  </style>

   
</head>
<body style="padding:10px">  


     <div id="layout1">
            <div position="left" style="overflow: auto;">
              <div id="treePanel" >
              <ul id="Orgtree"></ul>
              </div>
            </div><!-- end-->
            <div  position="center" title="">
             <div id="toptoolbar"></div> 
            <div class="l-panel-search">
                <div class="l-panel-search-item">
                   <span>姓名：</span>
                </div>
                <div class="l-panel-search-item">
                    <input id="txtUserName" type="text" ltype="text" />
                </div>
                 
                <div class="l-panel-search-item">
                    <a  class="l-button" style="width:60px; float:left; margin-left:10px;"   onclick="Search()">查询</a>&nbsp;
                   
                </div>
                 <div class="l-panel-search-item">
                  <a  class="l-button" style="width:60px; float:left; margin-left:10px;" onclick="Excel()">导出Excel</a>
                    <label>&nbsp;&nbsp;(<font color="red">注：双击行进行编辑</font>)</label>
                 </div>
            </div>
               <div id="maingrid">
               </div> 
            </div>
         
   </div> 
   <a id="ExdcleGo" href=""></a>
   <input type="hidden" id="Aid" value="0" />
   <input type="hidden" id="Rid" value="0" />
 
</body>
</html>
